<!DOCTYPE html>
<!-- saved from url=(0076)http://www.uphsh.com/wap/ef73d9dc381d412f964b99e521c270a6/invoice?userToken= -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!--<base href="http://www.uphsh.com:80/">--><base href=".">


<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta content="telephone=no" name="format-detection">
<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no">
<title>企业收款</title>
<link type="text/css" href="../../resource/ystfiles/wapcommon.css" rel="stylesheet">
<link type="text/css" rel="stylesheet" href="../../resource/ystfiles/fapiao.css">
<script src="../../resource/ystfiles/jquery180min.js" type="text/javascript"></script>
<script type="text/javascript" src="../../resource/ystfiles/wapcommon.js"></script>
<script src="../../resource/qrcode.js"></script>
	
	
<link rel="stylesheet" href="../../resource/ystfiles/weuimin.css">
<link rel="stylesheet" href="../../resource/ystfiles/example.css">
<script type="text/javascript" src="../../resource/ystfiles/api.js"></script>
<script type="text/javascript" src="../../resource/ystfiles/jweixin1002.js"></script>
<script type="text/javascript" src="../../resource/ystfiles/jweixin1.js"></script>
<script src="../../resource/jquery1.js"></script>
<script src="../../resource/qrcode.js"></script>
<script src="../../resource/jquerybarcode.js"></script>
<script src="../../script/api.js"></script>
<script src="../../resource/ystfiles/qrcode.js"></script>
<script src="../../resource/ystfiles/jquerybarcode.js"></script>
<script type="text/javascript" src="../../script/constants.js"></script>
<script type="text/javascript" src="../../script/tmd5.js"></script>
<script type="text/javascript" src="../../script/aes.js"></script>
<script type="text/javascript" charset="UTF-8" src="../../script/naes.js"></script>
<script type="text/javascript" src="../../script/modeecb.js"></script>
<style type="text/css">
   a.btn {
    width: 60px;
    line-height: 25px;
    display: block;
    text-align: center;
    font-size: 12px;
    background: rgba(51,51,51,0.3);
    color: #fff;
    border-radius: 5px;
		}
   .num {
   width: 60px;
   height:25px;
   color: #0000FF
   }
   .keyboard{
	    position: fixed;
	    z-index: 5000;
	    width: 100%;
	    background-color: #f2f2f2;
	    text-align: center;
	    bottom: 0%;
	    overflow: hidden;
   }
   #cac{   
	    width:100%;
	    height:100%;
	    background: #ffffff;
	    margin:0 auto;
	}
	.c_show{
	    width:90%;
	    height:5%;
	    border:1px solid #EEE9E9;
	    line-height:5%;
	    text-align:right;
	    font-size:50px;
	    color:#000;
	    margin: 0 auto;
	}
	.s_text{
	    width: 100%;
	    height:5%;
	    border:none;
	    line-height:5%;
	    text-align:right;
	    padding-right:20px;
	    font-size:50px;
	    color:#000;
	}
	#cac h2{    
	    font-size:16px;
	    color:#000;
	    font-weight:500;
	    padding:12px 0 12px 20px;
	    cursor:move;
	}
	.cancel{
	   background-color: #FF6347;
	   color: #ffffff;
	}
	.bkey{
	   background-color: #10AEFF;
	   color: #ffffff;
	}
    .ckey{
       width: 100%;
    }
    .ckey td{
        width:25%;
	    height:3%;
	    text-align:center;
	    line-height:400%;
	    font-size:18px;
	    cursor:pointer;
	    list-style:none;
	    border-top:1px solid #EEE9E9;
	    border-right:1px solid #EEE9E9;
    }
    .ckey td:active{
       background: #27a8fa;
	   color:#fff;
    }
    body{
      background: #ffffff;
    }
    </style>
    <!-- <script language="javascript" src="http://count26.51yes.com/click.aspx?id=268836397&logo=12" charset="gb2312"></script> -->
    <script type="text/javascript">
        window.apiready = function() {
            api.parseTapmode();
            if(api.systemType == "ios"){
			   document.getElementById("statusBar").style.background = "#298cb4";
			}
            $api.fixStatusBar( $api.dom('header') );
            var callback = function(ret, err){
		        if(ret.flag=="N"){
                    alert("首次使用,请先扫描注册商户二维码！");
                    scsm();
                  }else if(ret.flag=="Y"){
                  //获取商户号
                  var ypt_userid = ret.ypt_userid;
                  $api.setStorage("ypt_userid",ypt_userid);
                  
                  }
		    }
		    var content = {"phone":$api.getStorage("dl_phone")};
		    apiAjax(JSON.stringify(content),url.getuid,callback);
        }


        function scsm(){
         var FNScanner = api.require('FNScanner');
       		FNScanner.openScanner({
       		    autorotation: true
       		}, function(ret, err) {
       		setTimeout(function(){
       		       //console.log(JSON.stringify(ret));
       		       if(ret){
		       		   if(ret.eventType == "success"){
		       		     var content = JSON.stringify(ret.content);     
	       		         var userid_val = content.split('&')[4];
	       		         if(typeof(userid_val) == "undefined" || userid_val=="undefined"){
	       		            alert("二维码异常");
	       		            return;
	       		         }
	       		         var callback = function(ret, err){
					        if(ret.flag == "Y"){
		                       //获取商户号
		                        var ypt_userid = ret.user;  
		                  		$api.setStorage("ypt_userid",ypt_userid);
		                         smtjfpxx();
		                       }else{
		                          if(ret.msg == "DIFFERENCE"){
		                             alert("扫描二维码与绑定企业不一致！");
		                             api.closeWin();
		                          }else{
		                             alert("服务器异常！");
		                             api.closeWin();
		                           }
		                       }
					    }
					    var content = {"userid":userid_val,"phone":$api.getStorage("dl_phone"),"deviceName":api.deviceName,"openid":$api.getStorage("openid")};
					    apiAjax(JSON.stringify(content),url.scsm,callback);
		       		   }else if(ret.eventType == "cancel"){
		       		       api.closeWin();
		       		   }
	       		   }      
               },500); 
       		});

         }
  

    //点击输入金额执行函数
    function command(num){  
        var str = $("#result").val();
        str = (str == "0" ? "":str);
        str += num;
        $("#result").val(str);
    }
    
    function clearzero(){   
        $("#result").val(0);

    }
	function del(m){
	        var str = $("#result").val();
	        str = str.substring(0,str.length - 1);
	        str = (str == "" ? 0 : str);
	       $("#result").val(str);
    }
    function dot(m){
	        var str = $("#result").val();
	        if(str.length!=0){
	        str = str+m
	        }
	       
	       $("#result").val(str);
    }
         
          
    </script>
</head>

<body style="">
<header id="statusBar">
    <div class="header">
        <div class="return">
        	<img src="../../image/back.png" tapmode="presshover" style="left:0" onclick="toindex()" />
        </div>
        <div class="menu" style="display: none">
        	<a href="javaScript:;"></a>
        	<ul class="items" style="display: none;">
		    	<li data-href="plugin/helpCenter/find?id=47">帮助中心</li>
		    	<li data-href="wap/orders/ef73d9dc381d412f964b99e521c270a6">我的订单</li>
		    	<li data-href="userCenter/ef73d9dc381d412f964b99e521c270a6/wap/userInfo">我的账户</li>
		    </ul>
        </div>
        <div class="tittle">
    		企业收款
        </div>
    </div>
  </header>
    <div id="contant">
		<div style="margin-top:50px;">
			<div style="width: 50%;float: left;text-align: center;">
			<div style="width:50%;margin-left: 25%;"><img id="show" src="../../image/collection.png" style="display: block;width: 100%;margin: 0 auto;" tapmode="presshover" onclick="collection();"></div>
			<p>扫一扫</p>
			</div>
			
			<div  style="width: 50%;float: left;text-align: center;">
			<div style="width:50%;margin-left: 25%;"><img  id="show5" src="../../image/record.png" style="display: block;width: 100%;margin: 0 auto;" tapmode="presshover" onclick="record();"></div>
			<p>收款记录</p>
			</div>
		</div>
		
 <div class="js_dialog" id="iosDialog1" style="opacity: 1;">
            <div class="weui-mask" id="zftc1" style="display: none;"></div>
              <div class="keyboard" id="zftc" style="display: none;">
  <div id="cac">
        <div style="height:40px;color: #000;font-size: 16px;text-align: center;width: 100%;">输入金额</div>
        <div class="c_show">
        
            <input  class="s_text" value="0" id="result"/>
        </div>
        <div style="height:20px;"></div>
        <table class="ckey">
        <tr>
        <td tapmode="presshover" onclick="command(7);">7</td>
        <td tapmode="presshover" onclick="command(8);">8</td>
        <td tapmode="presshover" onclick="command(9);">9</td>
        <td class="bkey" tapmode="presshover" onclick="del('j')">←</td>
        </tr>
        <tr>
        <td tapmode="presshover" onclick="command(4);">4</td>
        <td tapmode="presshover" onclick="command(5);">5</td>
        <td tapmode="presshover" onclick="command(6);">6</td>
        <td class="bkey" tapmode="presshover" onclick="clearzero('j')">清空</td>
        </tr>
        <tr>
        <td tapmode="presshover" onclick="command(1);">1</td>
        <td tapmode="presshover" onclick="command(2);">2</td>
        <td tapmode="presshover" onclick="command(3);">3</td>
        <td class="bkey" tapmode="presshover" onclick="zf();">收款</td>
        </tr>
        <tr>
        <td tapmode="presshover" onclick="command(0);">0</td>
        <td tapmode="presshover" onclick="command('00');">00</td>
        <td tapmode="presshover" onclick="dot('.')">.</td>
        <td class="cancel" tapmode="presshover" onclick="cancel();">取消</td>
        </tr>
        </table>
          
    </div>
</div>
</div>	
		<!-- 加载动画 -->
	<div id="loadingToast" style="display:none;">
			<div class="weui-mask_transparent"></div>
			<div class="weui-toast">
				<i class="weui-loading weui-icon_toast"></i>
				<p class="weui-toast__content">收款中...</p>
			</div>
		</div>
		
</body>

<script>

    function aggregate(){
        api.openWin({
			name: 'aggregate',
			url: '../jhzf/myStore.html'
		});
    }

	function collection(){
		smtjfpxx();
	}
		
	function record(){
   		api.openWin({
                    name: 'wyfk',
                    url: 'skjl.html'
         	 });
	}	
	
    function smtjfpxx(){
			$("#zftc1").show();
			$("#zftc").show();
  	}
  	
    function cancel(){
         $("#zftc1").hide();
		 $("#zftc").hide();
    }
    
 function zf(){
      var je = $("#result").val();


       var reg = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/;
       if (reg.test(je)) {
        cancelOrder(je);
    }else{
         alert("金额输入有误！");
    };
    }

function toindex(){
        api.closeWin();
	}

    function cancelOrder(je) {

        api.confirm({
            title: '确认金额',
            msg: '是否继续？金额￥'+je+'元',
            buttons: [ '继续','取消']
        }, function(ret, err) {
            $("#zftc1").hide();
            if (ret.buttonIndex == 1) {
                shsk();
            }
        });

    }

    function shsk(){
      var FNScanner = api.require('FNScanner');
    		FNScanner.openScanner({
    		    autorotation: true
    		}, function(ret, err) {
          if(ret.content!=undefined){
               if(ret.content.length == 19 && ret.content.substring(0,2) == "62"){
                  $("#zftc").hide();
                  $("#loadingToast").show();
                  var con = ret.content;
                  var je = $("#result").val();
                  qrno = con;
                  
                  var aeskey = api.loadSecureValue({
			        sync: true,
			        key: 'aeskey'
			      });
			      var salt = api.loadSecureValue({
				        sync: true,
				        key: 'salt'
				    });
				    
				    var phone = $api.getStorage("dl_phone");
				    var openid = $api.getStorage("openid");
				    var content = {"qr":con,"je":je,"phone":phone,"openid":openid};
		            var callback = function(ret, err){
				        //console.log(JSON.stringify(ret));
				        if(ret.flag=="Y"){
                                mytime = setInterval(function(){
                                var callback = function(ret, err){
							         console.log(JSON.stringify(ret));
							               if(ret.flag=="Y"){
							                      $("#loadingToast").hide();
                                                  var lsh = ret.pd.LSH;
                                                  var rksj = ret.pd.RKSJ;
                                                  var je = ret.pd.JE;
                                                    clearTimeout(mytime);
                                                      api.openWin({
                                                          name: 'skts',
                                                          url: 'skts.html',
                                                          pageParam: {
                                                             lsh:lsh,
                                                             rksj:rksj,
                                                             je:je,
                                                             msg:ret.pd.BZ,
                                                             type:0
                                                             
                                                          }
                                                      });
                                                      alert("收款成功！");
                                                }else if(ret.flag=="N"){
                                                  clearTimeout(mytime);
                                                  $("#loadingToast").hide();
                                                  var lsh = ret.pd.LSH;
                                                  var rksj = ret.pd.RKSJ;
                                                  var je = ret.pd.JE;
                                                      api.openWin({
                                                          name: 'skts',
                                                          url: 'skts.html',
                                                          pageParam: {
                                                             lsh:lsh,
                                                             rksj:rksj,
                                                             je:je,
                                                             msg:ret.pd.BZ,
                                                             type:1
                                                          }
                                                      });
                                                      alert("收款失败！");
                                                }else if(ret.flag=="E"){
                                                  $("#loadingToast").hide();
                                                  alert(ret.msg);
                                                }
								    }
								    var content = {"qrno":con};
								    apiAjax(JSON.stringify(content),url.skzt,callback);
	                                
	                              }, 2000)
                            }else{
                                $("#loadingToast").hide();
                                api.alert({msg: "收款失败，原因："+ret.msg});
                            }
				    }
				    encApiAjax(JSON.stringify(content),url.shsk,callback);
				}else{
				   $("#zftc").hide();
				   alert("该二维码非银联二维码！");
				}
          }

          })
        }

</script>

</html>
